package com.server.questionbank.snframe.util.FileUtil.common.util;


import com.server.questionbank.snframe.util.FileUtil.common.constant.MultipartConstants;
import org.apache.commons.lang3.StringUtils;

/**
 * 参数验证工具类
 */
public final class ValidationUtils {
    private ValidationUtils() {}
    
    public static void validateBucket(String bucket) {
        if (StringUtils.isBlank(bucket)) {
            throw new IllegalArgumentException("Bucket name cannot be empty");
        }
    }
    
    public static void validateObject(String object) {
        if (StringUtils.isBlank(object)) {
            throw new IllegalArgumentException("Object name cannot be empty");
        }
    }
    
    public static void validateChunkSize(int chunkSize) {
        if (chunkSize < MultipartConstants.MIN_CHUNK_SIZE) {
            throw new IllegalArgumentException("Chunk size cannot be less than " + MultipartConstants.MIN_CHUNK_SIZE);
        }
        if (chunkSize > MultipartConstants.MAX_CHUNK_SIZE) {
            throw new IllegalArgumentException("Chunk size cannot be greater than " + MultipartConstants.MAX_CHUNK_SIZE);
        }
    }
}